"use strict";

const Parser = require("tree-sitter");
const JavaScript = require("tree-sitter-javascript");

const parser = new Parser();
parser.setLanguage(JavaScript);

const sourceCode = "let x = 1; console.log(x);";
const tree = parser.parse(sourceCode);

console.log(tree.rootNode.toString());

`
(program 
  (lexical_declaration 
    (variable_declarator name: (identifier) value: (number)))
  (expression_statement 
    (call_expression function: 
      (member_expression object: (identifier) property: (property_identifier)) arguments: (arguments (identifier)))))
`;
